#ifndef __SCU_SCULIST_H
#define __SCU_SCULIST_H

#include <scos.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct scu_listitem_s
{
  void *data;
  int owned;
  struct scu_listitem_s *next;
} scu_listitem_t;

typedef struct scu_list_s
{
  int size;
  scos_mutex_t lock;
  scu_listitem_t *start;
} scu_list_t;

scu_list_t scuListCreate(int size);
void scuListFree(scu_list_t *list);
void scuListLock(scu_list_t *list);
void scuListUnlock(scu_list_t *list);
int scuListGetLength(scu_list_t *list);
void *scuListAddItem(scu_list_t *list);
void *scuListAddPreallocatedItem(scu_list_t *list, void *data, int owned);
void *scuListGetItem(scu_list_t *list, int id);
void *scuListFindItem(scu_list_t *list, int offset, scu_vartype_t type, ...);
void scuListRemoveItem(scu_list_t *list, int id);
void *scuListEnumerateItems(scu_list_t *l, scu_listitem_t **item);

#ifdef __cplusplus
}
#endif

#endif /* __SCU_SCULIST_H */
